package com.hkycu.goodsseckill;

import org.apache.commons.lang3.StringUtils;

public class Test1 {
    public static void main(String[] args){
        System.out.println(new Test1().repeatedSubstringPattern("aba"));//baab
    }
    public boolean repeatedSubstringPattern(String s) {
        if (s.length()==1 || StringUtils.isEmpty(s) || s.length()==0){
            return false;
        }
        if (s.length() % 2 != 0){
            int flag=0;
            String s1=s.substring(0,1);
            for (int i = 0;i < s.length();i++){
                if (s1.equals(s.substring(i,i+1))){
                   flag ++;
                }
            }
            if (flag==s.length()){
                return true;
            }else {
                return false;
            }
        }else {
            String s1 = s.substring(0,s.length()/2);
            String s2 = s.substring(s.length()/2,s.length());
            if (s1.equals(s2)){
                return true;
            }else{
                return false;
            }
        }
    }
}
